% Get a list of stock codes randomly when given number of stocks
% Input: number_of_stocks, market_code
% Output: list_of_stock_codes
function list_of_stock_codes = getRandomStockCodes(market_code, number_of_stocks, min_num_transactions, min_mean_volume)
    % Get all stock codes of a market
    list_of_all_stock_codes = getAllStockCodes(market_code, min_num_transactions, min_mean_volume);
    number_of_all_stocks = length(list_of_all_stock_codes);
    list_of_stock_codes = [];
    if (~isempty(list_of_all_stock_codes)) % exists 
        % random number_of_stocks stock codes from a list of stock codes of
        % a market
        for i = 1:number_of_stocks 
            stock_index = randi(number_of_all_stocks);
            list_of_stock_codes = [list_of_stock_codes; list_of_all_stock_codes(stock_index)];
            list_of_all_stock_codes(stock_index) = list_of_all_stock_codes(number_of_all_stocks);
            number_of_all_stocks = number_of_all_stocks - 1;
        end
    else    
        list_of_stock_codes = [];
    end
        
end